# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cloakify
pkgver=117.f45c3b3
pkgrel=3
pkgdesc='Data Exfiltration In Plain Sight; Evade DLP/MLS Devices; Social Engineering of Analysts; Evade AV Detection.'
groups=('blackarch' 'blackarch-misc' 'blackarch-crypto')
arch=('any')
url='https://github.com/trycatchhcf/cloakify'
license=('MIT')
depends=('python2')
makedepends=('git')
source=("$pkgname::git+https://github.com/TryCatchHCF/Cloakify.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/$pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"

cat > "$pkgdir/usr/bin/decloakify" << EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/decloakify.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/decloakify"
}

